package org.csu.jpetstore_cms.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.csu.jpetstore_cms.pojo.Category;
import org.csu.jpetstore_cms.pojo.Product;

import java.util.List;

@Mapper
public interface ProductMapper {
    @Select("select * from product where category = #{categoryid}")
    List<Product> getProductByCategoryId(String categoryid);

    @Select("select * from product")
    List<Product> getAllProduct();
    @Delete("delete from product where productid = #{productId}")
    void DeleteByProductId(String productId);

    @Delete("delete from item where productid = #{productId}")
    void DeleteItemByProductId(String productId);

    @Insert("insert into product(productid,category,name,descn) values (#{productid},#{category},#{name},#{descn})")
    void CreatProduct(Product product);
    void UpdateProduct(Product product);
}
